#pragma once
#include "Common.h"

//将其设计成单例模式
class CentralCache
{
public:
	static CentralCache *GetInstance()
	{
		return &_sInstCentalCache;
	}
	//从CentralCache获取一定数量的对象给ThreadCache
	//要n个size大小的对象
	size_t FetchRangeObj(void *&start, void *&end, size_t n, size_t size);
	//获取一个非空的span
	Span *GetOneSpan(SpanList &list, size_t size);

	//将一定数量的对象释放到Span
	void ReleaseListToSpans(void *start, size_t size);

private:
	SpanList _spanLists[NUM_FREE_LIST];

	CentralCache(){};
	CentralCache(const CentralCache &) = delete;
	static CentralCache _sInstCentalCache;
};